<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-token" content="o6i0tTxsEgUfdnK84w92bpRoV9z6Xsxg3acVH1vW">
    <title>{$title}</title>

    <style type="text/css">
    	.form-group{
    		z-index: 1;
    	}
    </style>
    <meta name="keywords" content="用户注册"/>
    <meta name="description" content="用户注册"/>
    <link href="/static/index/sig/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/index/sig/css/account.css" rel="stylesheet">
    <link href="/static/index/login/css/layer.css" rel="stylesheet">

</head>
<body style="background: url('/static/index/sig/images/bg.png');">
<div class="container" style="margin-top: 150px;">
    <div style="background:#E0E0E0;opacity:0.7;border-radius: 20px;" class="col-md-6 col-md-offset-3 bg-white login-wrap">
        <h1 class="h4 text-center text-muted login-title">蒸汽男孩论坛注册</h1>
        <form role="form" id="registerForm" action="{:url('index/sig/doSig')}" method="post">
            <div class="form-group ">
                <input type="text" class="form-control" name="nick" value="" required placeholder="请输入昵称">
            </div>
            <div class="form-group ">
                <input name="phone" id="mobile" type="text" maxlength="11" placeholder="请输入11位手机号码" class="form-control"
                       value=""/>
            </div>
            <div class="form-group ">
                <div class="row">
                    <div class="col-xs-6">
                        <input name="code" id="code" type="text" maxlength="6" placeholder="请输入手机验证码"
                               class="form-control" value=""/>
                    </div>
                    <div class="col-xs-6">
                        <button class="btn btn-xl btn-default btn-send-code" data-mobile_id="mobile"
                                data-send_type="register" data-toggle="modal" data-target="#verify_code_modal"
                                type="button">发送验证码
                        </button>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <input type="password" class="form-control" name="pass" required placeholder="请输入密码">
            </div>
            <div class="form-group ">
                <input type="password" class="form-control" name="rpass" required placeholder="请确认密码">
            </div>
            <div class="form-group">
                <button type="submit" style="width: 200px;margin:0 auto;" class="btn btn-success btn-block btn-lg">注册</button>
            </div>
        </form>
    </div>


</div>
<script src="/static/index/sig/js/jquery.min.js"></script>
<script src="/static/index/login/js/layer.js"></script>
<script src="/static/index/sig/js/bootstrap.min.js"></script>
<div class="" id="verify_code_modal">

</div>

<script type="text/javascript">
    var countdown_second = 60;

    function Countdown(btn) {
        if (countdown_second == 0) {
            btn.attr("class", "btn btn-xl btn-default btn-send-code");
            btn.text("免费获取验证码");
            countdown_second = 60;
            return;
        } else {
            btn.attr("class", "btn btn-xl btn-default disabled");
            btn.text("重新发送(" + countdown_second + ")");
            countdown_second--;
        }
        setTimeout(function () {
                Countdown(btn)
            }
            , 1000)
    }

    $(function () {
        $('#verify_code_modal').on('show.bs.modal', function (event) {
            var button = $(event.relatedTarget);
            var mobile_id = button.data('mobile_id');
            var send_type = button.data('send_type');
            var mobile = $("#" + mobile_id).val();
            sendSmsCode();
        });

    });
    function sendSmsCode() {
        //        var mobile = $("#mobile").val();
        var mobile = $('#mobile').serialize();
        console.log(mobile);
        $.ajax({
            type: 'post',
            url: '/index/Sig/ccp/',
            data: mobile,
            dataTpye: 'json',
            success: function (data) {
                if (data.status) {
                    //                     console.log(data);
                    $('#verify_code_modal').modal('hide');
                    Countdown($(".btn-send-code"));
                } else {
                    $("#reloadCaptcha").trigger('click');
                    layer.msg('警告 :手机号码已注册');
                    return false;
                }
            },
            error: function () {
                //                console.log('ad');
            }
        });
    }
</script>
</body>
</html>



